/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2024 All Rights Reserved.
 */
package com.bohong.freshShop.controller;

import com.bohong.freshShop.common.WebSocketSingleServer;
import com.bohong.freshShop.dao.entity.UserEntity;
import com.bohong.freshShop.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author runhong.wyb
 * @version $Id: HelloController.java, v 0.1 2024-01-18 17:05 san.zhang Exp $$
 */
@RestController
public class HelloController {

    @Autowired
    private UserService userService;

    @GetMapping("/hello/{userId}")
    public String hello(@PathVariable("userId") String userId) throws IOException {
        WebSocketSingleServer.sendInfo("new order",userId);
        return "true";
    }

    @GetMapping("/hello/query")
    public UserEntity getUser() {
//        userService.qu
        UserEntity userEntity = new UserEntity();
        userEntity.setUsername("wang");
        return userEntity;
    }

}
